-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable CI builds for aarch64-macos
#3137
Conversation
The tests are conditionally disabled for this target because the x86_64 CI host is unable to run AArch64 binaries. (There is no officially-supported reverse Rosetta 2.)
Certain targets, such as `aarch64-apple-*`, require additional compiler flags to cross-compile for the intended target.
aarch64-macos
aarch64-macos
Do we need to do anything special to support this in the homebrew tap? https://github.com/helix-editor/homebrew-helix/blob/master/Formula/helix.rb |
Looks like we need a conditional: https://github.com/golangci/homebrew-tap/blob/bb0e7c6fa14d7fd771e1a5941f5e3ca85a15624c/Formula/golangci-lint.rb#L11-L40= |
I believe switching on_macos do
if Hardware::CPU.arm?
url "https://github.com/helix-editor/helix/releases/download/#{version}/helix-#{version}-aarch64-macos.tar.xz"
sha256 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
end
if Hardware::CPU.intel?
url "https://github.com/helix-editor/helix/releases/download/#{version}/helix-#{version}-x86_64-macos.tar.xz"
sha256 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
end
end |
.target(BUILD_TARGET); | ||
.target(target.unwrap_or(BUILD_TARGET)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would target
be different from BUILD_TARGET
? Both come from TARGET
environment variables in build scripts, BUILD_TARGET
from the helix-loader
crate's build script and target
from helix-term
's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When helix_loader::build_grammars
is being used for cross compilation.
BUILD_TARGET
represents the target on which the code of helix-loader
runs. helix-term
's build script (which has helix-loader
as build-dependency) needs to use helix-loader
to cross-compile for helix-term
's target, which may be different from BUILD_TARGET
.
E.g., when cross-compiling helix-term
to an aarch64
target on an x86_64
host, two binaries of helix-loader
are built:
-
One binary for
aarch64
target for use byhelix-term
's main crate (normal dependency)helix-loader
's build script runs withTARGET = "aarch64"
- Hence,
env!("BUILD_TARGET") = "aarch64"
helix-term
's main crate code passestarget = None
because it wants to compile grammars for the current host =helix-loader
's build target
-
One binary for
x86_64
target for use byhelix-term
's build script (build dependency)helix-loader
's build script runs withTARGET = "x86_64"
- Hence,
env!("BUILD_TARGET") = "x86_64"
helix-term
's build script passestarget = "aarch64"
because it wants to cross-compile grammars forhelix-term
's build target, not the host on which the build script runs
Simplifies a conditional expression in the CI workflow configuration. Co-authored-by: Michael Davis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me then :)
I tried out your example run artifacts on an aarch64-macos machine and it all works great 🎉
Thanks for working on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @yvt!
Closes #1647.
A preview CI run based on this patch and the built artifacts can be found at https://github.com/yvt/helix/actions/runs/2709143241.